import { apiClient } from './api';

export interface DraftWithUrlsResponse {
    success: boolean;
    code: number;
    message: string;
    data: {
        draft_info: {
            id: string;
            name: string;
            width: number;
            height: number;
            fps: number;
            creator: string;
            type: string;
            status: string;
            isPublic: boolean;
            detail: string;
            created_time: string;
            updated_time: string;
            export_video_url: string | null;
        };
        script_content: {
            canvas_config: {
                width: number;
                height: number;
                ratio: string;
            };
            color_space: number;
            config: any;
            cover: any;
            create_time: number;
            duration: number;
            extra_info: any;
            fps: number;
            free_render_index_mode_on: boolean;
            group_container: any;
            id: string;
            keyframe_graph_list: any[];
            keyframes: any;
            last_modified_platform: any;
            platform: any;
            materials: {
                videos: any[];
                audios: any[];
                images: any[];
                texts: any[];
                stickers: any[];
                effects: any[];
                transitions: any[];
                masks: any[];
                canvases: any[];
            };
            mutable_config: any;
            name: string;
            new_version: string;
            relationships: any[];
            render_index_track_mode_on: boolean;
            retouch_cover: any;
            source: string;
            static_cover_image_path: string;
            time_marks: any;
            tracks: any[];
            update_time: number;
            version: number;
        };
        canvas_config: {
            width: number;
            height: number;
            ratio: string;
        };
        duration: number;
        fps: number;
        total_tracks: number;
        total_materials: {
            videos: number;
            audios: number;
            images: number;
            texts: number;
        };
    };
}

export const getDraftWithUrls = async (draftId: string): Promise<DraftWithUrlsResponse['data']> => {
    const response = await apiClient.get(`/draft/detail-with-urls/${draftId}/`);
    return response.data;
};
